function global:Multip_Helpers { <# .SYNOPSIS MultIP_Helpers provides a set of Powershell helper functions to manage a Radio IP Mult-IP Gateway system. .DESCRIPTION Available functions: get-multip Returns a multip gateway object (password is masked) get-gtws Returns the UUIDs of the gateways in this context show-mipclientspergroup Returns the number of mobile clients per group start-mipservices Starts all Mult-IP services stop-mipservices Stops all Mult-IP services. #> return $null } function global:get-multip( [Parameter(Mandatory=$true)] [string] $username ) { $s = read-host -Prompt "password" -AsSecureString $password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($s)) $reserved = $null; #GE Check if the global variable __mip already exists of is valid $mip = Get-Variable -Name __mip -Scope Global -ErrorAction SilentlyContinue; if(($mip -eq $null) -or ($mip.objName -eq $null)) { #GE Create a new Mult-IP object and open its session. $global:__mip = New-Object -ComObject radioip.therock; $mip = $global:__mip; $mip.OpenSession($username, $password, $reserved); } $mip; } function global:get-gtws { [cmdletbinding()] param ( [Parameter(Mandatory=$false)] [string] $contextName = "" ) $rip = rip-getRipInstanceListener start-sleep -m 2000 $xml = rip-getInstances -rip $rip -instanceName therock -contextName $contextName $res = @(); $node = $xml.SelectSingleNode("//instance") while ($node -ne $null) { if($node.uniqueid -ne "") { $res += $node.uniqueid } $node = $node.NextSibling } return ,$res; #GE Return the result as an array (the , is not a typo... Powershell tweak!) } function global:show-master { $res = rip-getMasterName $res; } function global:start-mipservices { net start "Radio IP RIPStorage" net start "Radio IP License Server" net start "Radio IP NDIS Server" net start "Radio IP Mult-IP Gateway" net start "Radio IP Mult-IP Front End Monitor" net start "Radio IP RU Agent" } function global:stop-mipservices { net stop "Radio IP RIPStorage" net stop "Radio IP License Server" net stop "Radio IP NDIS Server" net stop "Radio IP Mult-IP Gateway" net stop "Radio IP Mult-IP Front End Monitor" net stop "Radio IP RU Agent" } function global:show-mipclientspergroup { (get-multip).Clients | group-Object GroupName | Format-Table -Property Count, Name } Write-Host -ForegroundColor Red @" Mult-IP Helpers 3.11.2 loaded. (c) Radio IP Software 2014 "@ write-host -ForegroundColor White @" Available functions: get-multip Returns a multip gateway object (password is masked) get-gtws Returns the UUIDs of the gateways in this context show-mipclientspergroup Returns the number of mobile clients per group start-mipservices Starts all Mult-IP services stop-mipservices Stops all Mult-IP services. "@